﻿<navigation:Page x:Class="AppLab.Views.Role" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:local="clr-namespace:AppLab"
           xmlns:control="clr-namespace:AppLab.Controls"
           xmlns:web="clr-namespace:AppLab.Web"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
           d:DesignWidth="640" d:DesignHeight="480"
           d:DataContext="{d:DesignInstance Type=web:RolesForUser}" 
           Style="{StaticResource PageStyle}"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">

    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >
            <toolkit:BusyIndicator x:Name="busyIndicatorLoad"  BusyContent="{Binding Path=ApplicationStrings.BusyIndicatorLoad, Source={StaticResource ResourceWrapper}}">
                <toolkit:BusyIndicator x:Name="busyIndicator" BusyContent="{Binding Path=ApplicationStrings.BusyIndicatorRegisteringUser, Source={StaticResource ResourceWrapper}}"
                             IsBusy="{Binding IsBusy}">
                    <StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">

                        <Grid Height="30">
                            <TextBlock Style="{StaticResource ContentTextStyle}" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding Path=ApplicationStrings.RolePageContentText, Source={StaticResource ResourceWrapper}}"/>
                            <Button Name="RestoreRolesForUser" Content="刷新" Style="{StaticResource LoginRegisterLinkStyle}" 
                                    Height="auto" Click="RestoreRolesForUser_Click" HorizontalAlignment="Left" 
                                    VerticalAlignment="Top" Margin="880,10,0,0" Foreground="Blue"></Button>
                        </Grid>

                        <sdk:DataGrid Name="dgRoleManagement" AutoGenerateColumns="False" SelectionMode="Single"  Margin="25,0,0,0" 
                          CanUserReorderColumns="False" HorizontalAlignment="Left"  VerticalAlignment="Top" GridLinesVisibility="Vertical"
                          AlternatingRowBackground="LightGray" SelectionChanged="dgRoleManagement_SelectionChanged" >
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTemplateColumn>
                                    <sdk:DataGridTemplateColumn.HeaderStyle>
                                        <Style TargetType="dataprimitives:DataGridColumnHeader">
                                            <Setter Property="ContentTemplate">
                                                <Setter.Value>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                                <TextBlock Margin="8,0,0,0" Text="账号" Width="100" FontSize="12" Foreground="Blue"/>
                                                                <TextBlock Text="用户名" Width="100" FontSize="12" Foreground="Blue"/>
                                                            </StackPanel>

                                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
                                                                <TextBlock Text="终端版本" Width="90" FontSize="12" Foreground="Blue"/>
                                                                <TextBlock Text="终端信息" Width="80" FontSize="12" Foreground="Blue"/>
                                                                <TextBlock Margin="3,0,0,0" Text="提交" Width="70" FontSize="12" Foreground="Blue"/>
                                                                <TextBlock Text="审核" Width="70" FontSize="12" Foreground="Blue"/>
                                                                <TextBlock Text="验收" Width="70" FontSize="12" Foreground="Blue"/>
                                                                <TextBlock Text="发布" Width="70" FontSize="12" Foreground="Blue"/>
                                                                <TextBlock Text="角色管理" Width="70" FontSize="12" Foreground="Blue"/>
                                                            </StackPanel>

                                                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                                <TextBlock Text="操作" Width="40" FontSize="12" Foreground="Blue"/>
                                                            </StackPanel>
                                                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                                <TextBlock Text="刪除用户" FontSize="12" Foreground="Blue"/>
                                                            </StackPanel>
                                                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                                <TextBlock Text="密码重置" FontSize="12" Foreground="Blue" Margin="15,0,0,0"/>
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </sdk:DataGridTemplateColumn.HeaderStyle>

                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal" Height="30" >
                                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  HorizontalAlignment="Center">
                                                    <TextBlock Margin="8,0,0,0" Width="100" Text="{Binding Alias}"/>
                                                    <TextBlock Width="100" Text="{Binding DisplayName}"/>
                                                </StackPanel>

                                                <StackPanel Orientation="Horizontal"  HorizontalAlignment="Center" VerticalAlignment="Center">
                                                    <!--<CheckBox Margin="15,0,0,0"  IsChecked="{Binding IsRegister}" IsEnabled="False" />-->
                                                    <CheckBox Margin="20,0,0,0" IsChecked="{Binding IsHistory}" IsEnabled="False"/>
                                                    <CheckBox Margin="72,0,0,0"  Name="ckBoxTerminalInfo" IsChecked="{Binding IsTerminalInfo}" Click="ckBoxTerminalInfo_Click" />
                                                    <CheckBox Margin="55,0,0,0" Name="ckBoxSubmit" IsChecked="{Binding IsSubmit}" Click="ckBoxSubmit_Click"/>
                                                    <CheckBox Margin="55,0,0,0" Name="ckBoxReview" IsChecked="{Binding IsReview}" Click="ckBoxReview_Click"/>
                                                    <CheckBox Margin="53,0,0,0" Name="ckBoxIsTask" IsChecked="{Binding IsTask}" Click="ckBoxIsTask_Click"/>
                                                    <CheckBox Margin="53,0,0,0" Name="ckBoxPublic" IsChecked="{Binding IsPublish}" Click="ckBoxPublic_Click"/>
                                                    <CheckBox Margin="65,0,0,0" Name="ckBoxRole" IsChecked="{Binding IsRole}" Click="ckBoxRole_Click"/>
                                                </StackPanel>

                                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                    <Button Margin="35,0,0,0" Name="SaveRolesForUser" Content="保存" Style="{StaticResource LoginRegisterLinkStyle}" Click="SaveRolesForUser_Click" Foreground="Blue"></Button>
                                                </StackPanel>
                                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                    <Button Margin="30,0,0,0" Name="DeleteUser" Content="刪除" Style="{StaticResource LoginRegisterLinkStyle}" Click="DeleteUser_Click"  Foreground="Blue"></Button>
                                                </StackPanel>
                                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                    <Button Margin="35,0,0,0" Name="ResetPassword" Content="重置" Style="{StaticResource LoginRegisterLinkStyle}" Click="ResetPassword_Click" Foreground="Blue"></Button>
                                                </StackPanel>
                                            </StackPanel>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>

                                    <!--<sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" Height="30" >
                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  HorizontalAlignment="Center">
                                        <TextBlock Width="80" Text="{Binding Alias}"/>
                                        <TextBlock Width="80" Text="{Binding DisplayName}"/>
                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal"  HorizontalAlignment="Center" VerticalAlignment="Center">
                                        <CheckBox Width="80" IsChecked="{Binding IsRegister}" IsEnabled="False"/>
                                        <CheckBox Width="80" Name="ckBoxTerminalInfo" IsChecked="{Binding IsTerminalInfo,Mode=TwoWay}"/>
                                        <CheckBox Width="80" IsChecked="{Binding IsHistory}" IsEnabled="False"/>
                                        <CheckBox Width="80" Name="ckBoxSubmit" IsChecked="{Binding IsSubmit,Mode=TwoWay}" Click="ckBoxSubmit_Click"/>
                                        <CheckBox Width="80" Name="ckBoxReview" IsChecked="{Binding IsReview,Mode=TwoWay}" />
                                        <CheckBox Width="80" Name="ckBoxIsTask" IsChecked="{Binding IsTask,Mode=TwoWay}"/>
                                        <CheckBox Width="80" Name="ckBoxPublic" IsChecked="{Binding IsPublic,Mode=TwoWay}" />
                                        <CheckBox Width="80" Name="ckBoxRole" IsChecked="{Binding IsRole,Mode=TwoWay}" />
                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                        <HyperlinkButton Name="SaveRolesForUser" Content="保存" Click="SaveRolesForUser_Click"></HyperlinkButton>
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>-->

                                </sdk:DataGridTemplateColumn>

                            </sdk:DataGrid.Columns>

                            <!--直接不允许修改数据-->
                            <!--<sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Width="80" Header="账号" Binding="{Binding Alias}"/>
                    <sdk:DataGridTextColumn Width="80" Header="用户名" Binding="{Binding DisplayName}"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="Register" Binding="{Binding IsRegister}" IsReadOnly="True"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="手机维护" Binding="{Binding IsTerminalInfo}" />
                    <sdk:DataGridCheckBoxColumn Width="80" Header="浏览历史" Binding="{Binding IsHistory}" IsReadOnly="True"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="厂商提交" Binding="{Binding IsSubmit}" />
                    <sdk:DataGridCheckBoxColumn Width="80" Header="审核" Binding="{Binding IsReview}"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="验收" Binding="{Binding IsTask}" />
                    <sdk:DataGridCheckBoxColumn Width="80" Header="Publish" Binding="{Binding IsPublic}" />
                    <sdk:DataGridCheckBoxColumn Width="80" Header="角色管理" Binding="{Binding IsRole}" />
                    <sdk:DataGridTemplateColumn Width="80" Header="操作" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <HyperlinkButton Name="SaveRolesForUser" Content="保存" Click="SaveRolesForUser_Click"></HyperlinkButton>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>-->

                            <!--<sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Width="80" Header="账号" Binding="{Binding Alias}"/>
                    <sdk:DataGridTextColumn Width="80" Header="用户名" Binding="{Binding DisplayName}"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="Register" Binding="{Binding IsRegister}" IsReadOnly="True"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="浏览历史" Binding="{Binding IsHistory}" IsReadOnly="True"/>

                    <sdk:DataGridTemplateColumn Width="80" Header="手机维护">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxTerminalInfo" IsChecked="{Binding IsTerminalInfo, Mode=TwoWay}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="厂商提交" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxSubmit" IsChecked="{Binding IsSubmit, Mode=TwoWay}" HorizontalAlignment="Center" Click="ckBoxSubmit_Click"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="审核" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxReview" IsChecked="{Binding IsReview, Mode=TwoWay}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="验收" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxIsTask" IsChecked="{Binding IsTask, Mode=TwoWay}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="Publish" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxPublic" IsChecked="{Binding IsPublic, Mode=TwoWay}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="角色管理" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxRole" IsChecked="{Binding IsRole, Mode=TwoWay}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="操作" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <HyperlinkButton Name="SaveRolesForUser" Content="保存" Click="SaveRolesForUser_Click"></HyperlinkButton>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>-->

                            <!--<sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Width="80" Header="账号" Binding="{Binding Alias}"/>
                    <sdk:DataGridTextColumn Width="80" Header="用户名" Binding="{Binding DisplayName}"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="Register" Binding="{Binding IsRegister}" IsReadOnly="True"/>
                    <sdk:DataGridCheckBoxColumn Width="80" Header="浏览历史" Binding="{Binding IsHistory}" IsReadOnly="True"/>

                    <sdk:DataGridTemplateColumn Width="80" Header="手机维护">
                        <sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxTerminalInfo" IsChecked="{Binding IsTerminalInfo}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="厂商提交" >
                        <sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxSubmit" IsChecked="{Binding IsSubmit}" HorizontalAlignment="Center" Click="ckBoxSubmit_Click"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="审核" >
                        <sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxReview" IsChecked="{Binding IsReview}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="验收" >
                        <sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxIsTask" IsChecked="{Binding IsTask}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="Publish" >
                        <sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxPublic" IsChecked="{Binding IsPublic}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="角色管理" >
                        <sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <CheckBox Name="ckBoxRole" IsChecked="{Binding IsRole}" HorizontalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    </sdk:DataGridTemplateColumn>

                    <sdk:DataGridTemplateColumn Width="80" Header="操作" >
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <HyperlinkButton Name="SaveRolesForUser" Content="保存" Click="SaveRolesForUser_Click"></HyperlinkButton>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>-->

                        </sdk:DataGrid>

                        <!--<sdk:DataPager Name="dpRoleManagement" VerticalAlignment="Top" IsTotalItemCountFixed="True" HorizontalAlignment="Left"  Source="{Binding ItemsSource, ElementName=dgRoleManagement}" Margin="25,0,0,0">
                        </sdk:DataPager>-->
                    </StackPanel>
                </toolkit:BusyIndicator>
            </toolkit:BusyIndicator>
        </ScrollViewer>
    </Grid>
</navigation:Page>
